package com.wu.ssm.mybatis;


import java.lang.reflect.Proxy;

/**
 * Created by wzf on 2018/11/13/013.
 */
public class MyMapperProxyFactory <T> {


    public  T newInstance(MyMapperProxy<T> mapperProxy){
        return (T) Proxy.newProxyInstance(UserMapper.class.getClassLoader(), new Class[]{UserMapper.class},mapperProxy);
    }

    protected T newInstance(MyDefaultSqlsession sqlsession){
        final MyMapperProxy<T> mapperProxy = new MyMapperProxy<T>(sqlsession, (Class<T>) UserMapper.class);
        return (T) newInstance(mapperProxy);
    }
}
